<include file="public/layout"/>
<script src="__ROOT__/public/static/js/layer/laydate/laydate.js"></script>
<body style="background-color: #FFF; overflow: auto;">
<div id="toolTipLayer"
     style="position: absolute; z-index: 9999; display: none; visibility: visible; left: 95px; top: 573px;"></div>
<div id="append_parent"></div>
<div id="ajaxwaitid"></div>
<div class="page">
    <div class="fixed-bar">
        <div class="item-title"><a class="back" href="javascript:history.back();" title="返回列表"><i
                class="fa fa-arrow-circle-o-left"></i></a>

            <div class="subject"><h3>团购管理 - 编辑团购</h3>                <h5>网站系统抢购活动详情页</h5></div>
        </div>
    </div>
    <form class="form-horizontal" action="{:U('Admin/Promotion/groupbuyHandle')}" id="handleposition" method="post">
        <input type="hidden" id="goods_id" name="goods_id" value="{$info.goods_id}"> <input type="hidden" name="id"
                                                                                            value="{$info.id}"> <input
            type="hidden" name="act" value="{$act}">

        <div class="ncap-form-default">
            <dl class="row">
                <dt class="tit"><label>供应商</label></dt>
                <dd class="opt">
                    <div class="sDiv2">
                        <if condition="$suppliers_id"><select name="suppliers" class="small form-control">
                            <option value="{$suppliers_id.suppliers_id}">{$suppliers_id.suppliers_name}</option>
                        </select>
                            <else/>
                            <select name="suppliers" class="small form-control">
                                <option value="0">请选择供应商</option>
                                <volist name="suppliers" id="vo">
                                    <option
                                    <if condition="$vo['suppliers_id'] eq $info['suppliers_id']">selected</if>
                                    value="{$vo.suppliers_id}">{$vo.suppliers_name}</option>
                                </volist>
                            </select></if>
                    </div>
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit"><label><em>*</em>团购标题</label></dt>
                <dd class="opt"><input type="text" name="title" id="title" value="{$info.title}" class="input-txt">

                    <p class="notic">请填写团购标题</p></dd>
            </dl>
            <dl class="row">
                <dt class="tit"><label><em>*</em>开始时间</label></dt>
                <dd class="opt"><input type="text" id="start_time" name="start_time" value="{$info.start_time}"
                                       class="input-txt">

                    <p class="notic">团购开始时间</p></dd>
            </dl>
            <dl class="row">
                <dt class="tit"><label><em>*</em>结束时间</label></dt>
                <dd class="opt"><input type="text" id="end_time" name="end_time" value="{$info.end_time}"
                                       class="input-txt">

                    <p class="notic">团购结束时间</p></dd>
            </dl>
            <dl class="row">
                <dt class="tit"><label><em>*</em>选择团购商品</label></dt>
                <dd class="opt"><input type="text" readonly id="goods_name" name="goods_name" value="{$info.goods_name}"
                                       class="input-txt"> <span class="err"></span>

                    <p class="notic"><a onclick="selectGoods()" class="ncap-btn"><i class="fa fa-search"></i>选择商品</a>
                    </p></dd>
            </dl>
            <dl class="row">
                <dt class="tit"><label><em>*</em>团购价格</label></dt>
                <dd class="opt"><input type="text" id="price" name="price" value="{$info.price}"
                                       onpaste="this.value=this.value.replace(/[^\d.]/g,'')"
                                       onkeyup="this.value=this.value.replace(/[^\d.]/g,'')" class="input-txt"> <input
                        type="hidden" id="goods_price" name="goods_price" value="{$info.goods_price}">

                    <p class="notic">商品团购价格,单位：元</p></dd>
            </dl>
            <dl class="row">
                <dt class="tit"><label><em>*</em>参团数量</label></dt>
                <dd class="opt"><input type="text" name="goods_num" id="goods_num" value="{$info.goods_num}"
                                       onpaste="this.value=this.value.replace(/[^\d.]/g,'')"
                                       onkeyup="this.value=this.value.replace(/[^\d.]/g,'')" class="input-txt">

                    <p class="notic">此抢购活动最多允许抢购的商品数量</p></dd>
            </dl>
            <dl class="row">
                <dt class="tit"><label><em>*</em>虚拟购买数</label></dt>
                <dd class="opt"><input type="text" id="virtual_num" name="virtual_num" value="{$info.virtual_num}"
                                       onpaste="this.value=this.value.replace(/[^\d.]/g,'')"
                                       onkeyup="this.value=this.value.replace(/[^\d.]/g,'')" class="input-txt">

                    <p class="notic">虚拟已购买参团人数</p></dd>
            </dl>
            <dl class="row">
                <dt class="tit"><label>团购介绍</label></dt>
                <dd class="opt"><textarea placeholder="请输入活动介绍" name="intro" rows="6"
                                          class="tarea">{$info.intro}</textarea>

                    <p class="notic">团购描述介绍</p></dd>
            </dl>
            <div class="bot"><a onclick="adsubmit()" class="ncap-btn-big ncap-btn-green">确认提交</a></div>
        </div>
    </form>
</div>
<script type="text/javascript">    $(document).ready(function () {
    $('#start_time').layDate();
    $('#end_time').layDate();
})
function adsubmit() {
    if ($('#title').val() == '') {
        layer.msg('团购标题不能为空');
        return;
    }
    if ($('#price').val() == '') {
        layer.msg('团购价格不能为空');
        return;
    }
    if ($('#group_num').val() == '') {
        layer.msg('限购数量不能为空');
        return;
    }
    $('#handleposition').submit();
}
function selectGoods() {
    var url = "{:U('Promotion/search_goods',array('tpl'=>'select_goods'))}";
    layer.open({type: 2, title: '选择商品', shadeClose: true, shade: 0.2, area: ['75%', '75%'], content: url,});
}
function call_back(goods_id, goods_name, store_count, price) {
    $('#goods_id').val(goods_id);
    $('#goods_name').val(goods_name);
    $('#group_num').val(store_count);
    $('#goods_price').val(price);
    layer.closeAll('iframe');
}</script>
</body></html>